<% layout('/layouts/default.html', {title: '考核任务信息表管理', libs: ['dataGrid']}){ %>
<style>
	.menu {
		padding: 2px;
		cursor: pointer;
		margin: 2px 1px 2px;
	}

	.options {
		position: absolute;
		display: none;
		width: 100px;
		height: 200px;
		background: #eee;
		/*overflow: auto;*/
	}

	.menu:hover .options {
		display: block;
	}
</style>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<#form:form id="searchForm" model="${dcSupExamInfo}" action="${ctx}/exam/dcSupExamInfo/listData" method="post" class="form-inline "
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
<!--				<div class="form-group">-->
<!--					<label class="control-label">${text('年度')}：</label>-->
<!--					<div class="control-inline width-120">-->
<!--						<#form:select path="examYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120" defaultValue="${currentYear}"/>-->
<!--					</div>-->
<!--				</div>-->
				<div class="form-group">
					<label class="control-label">${text('考核标题')}：</label>
					<div class="control-inline width-160">
						<#form:input path="examTitle" maxlength="100" class="form-control width-160" placeholder="请输入考核标题"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</div>
		</#form:form>
	</div>
	<div class="box-body">
<!--		<a href="#"  onclick="addKpi()" class="btn btn-primary btn-sm mr10 mb10" style="background-color:#00B7EE;border-color: #00b7ee;margin-left: 10px" title="${text("新增目标考核")}"><i class="fa fa-plus"></i> 新增目标考核</a>-->
		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>
</div>
<% } %>
<script>
	$('dataGrid').css('margin-bottom','230px')
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("主键")}', name:'id', hidden:true},
		{header:'${text("考核标题")}', name:'examTitle', index:'a.exam_title', width:150, align:"left",
			formatter: function(val, obj, row, act){
				return '<a href="${ctx}/exam/dcSupExamInfo/form?id='+row.id+'" class="btnList" data-title="${text("考核任务信息详情")}">'+(val||row.id)+'</a>';
			}},
		{header:'${text("考核年份")}', name:'examYear', index:'a.exam_year', width:100, align:"center"},
		{header:'${text("发布时间")}', name:'createDate', index:'a.create_date', width:100, align:"center"},
		{header:'${text("发布状态")}', name:'examStatus', index:'a.exam_status', width:100, align:"center"
			, formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('dc_exam_status')}, val, '${text("未知")}', true);
			}},
		// {header:'${text("考核通知流程")}', name:'examProgress', index:'a.exam_progress', width:150, align:"left"},
		{
			header: '操作', name: 'testSelect', width: 100, title: false, align: "center",
			formatter: function (val, obj, row, act) {
				var  actions=[];
				// return '    <div class="menu" >\n' +
				// 		'       <div id="u62_text" class="text ">\n' +
				// 		'                <p style="font-size: 14px;" id="cache4"><span class="btn-primary btn-xs">更多操作</span></p>\n' +
				// 		'              </div>' +
				// 		'        <div class="options" style="margin-left: 25px;">\n' +
				// 		'            <div style="margin-bottom: 10px"><a href="${ctx}/exam/dcSupExamInfo/undo?id=' + row.id + '" class="btnList"     data-confirm="${text("您确定撤回该目标考核吗？ 目标考核撤回后,报送单位将不再报送指标!")}" >撤销</a></div>\n' +
				// 		'            <div style="margin-bottom: 10px"><a href="#" onclick=keyNotice("' + row.id + '","' + row.examYear + '","1")>关键指标报送通知</a></div>\n' +
				// 		'            <div style="margin-bottom: 10px"><a href="#" onclick=keyNotice("' + row.id + '","' + row.examYear + '","2")>单项指标报送通知</a></div>\n' +
				// 		'            <div style="margin-bottom: 10px"><a href="#" onclick=keyNotice("' + row.id + '","' + row.examYear + '","5")>指标汇总</a></div>\n' +
				// 		'            <div style="margin-bottom: 10px"><a href="#" onclick=keyNotice("' + row.id + '","' + row.examYear + '","3")>发布自评通知</a></div>\n' +
				// 		'            <div style="margin-bottom: 10px"><a href="#" onclick=keyNotice("' + row.id + '","' + row.examYear + '","4")>发布评分通知</a></div>\n' +
				// 		'\n' +
				// 		'        </div>\n' +
				// 		'\n' +
				// 		'    </div>'
				actions.push('<a href="javascript:void(0);"  onclick=keyNotice("' + row.id + '","' + row.examYear + '","5") class="btn btn-primary btn-xs" title="${text("查看")}"><span>指标汇总</span></a>&emsp;');
				return actions.join('');

			}
		}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){

	}
});

//打开新的标签
function addKpi() {
	js.addTabPage(null, "新增目标考核","${ctx}/exam/dcSupExamInfo/form", true);
}
function keyNotice(id,examYear,noticeType){
	// 如果机构存在未审核的指标，则不能够进行指标汇总
	$.ajax({
		url: "${ctx}/quota/dcSupExamSumQuota/isExistNoAudit",
		type: "post",
		cache: false,
		async:false,
		data: {
			"examId":id,
			"examYear":examYear
		},
		success: function(res){
			if (res.message == '1'){
				js.showMessage("存在未审核的关键和单项指标,请先完成指标审核操作!!");
			}else if(res.message == '2'){
				js.showMessage("存在未审核的关键指标,请先完成指标审核操作!!");
			}else if (res.message == '3'){
				js.showMessage("存在未审核的单项指标,请先完成指标审核操作!!");
			}else{
				js.addTabPage(null, "指标汇总","${ctx}/quota/dcSupExamSumQuota/newIndex?examId="+id+"&examYear="+examYear, true);
			}
		}
	});

	// if (noticeType == '5'){
	// 	js.addTabPage(null,null, noticeType, '${text("指标汇总")}', true),"${ctx}/quota/dcSupExamSumQuota/list?examId="+id+"&examYear="+examYear, true);
	// }else {
	// 	js.addTabPage(null,js.getDictLabel(${@DictUtils.getDictListJson('dc_notice_type')}, noticeType, '${text("未知")}', true),"${ctx}/notice/dcSupExamNotice/form?examId="+id+"&examYear="+examYear+"&noticeType="+noticeType, true);
	// }
}

function openTable(id,examYear){
		js.addTabPage(null,js.getDictLabel(${@DictUtils.getDictListJson('dc_notice_type')}, null, '${text("编辑")}', true),"${ctx}/exam/dcSupExamInfo/form?id="+id+"&examYear="+examYear+"&type=1", true);
}
	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}
</script>
<style>

	.ui-jqgrid .ui-jqgrid-btable{
		margin-bottom: 170px;
	}
	.pp{
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.dd{
		/*padding: 4% 15%;*/
		border: 1px solid #0079fe;
		color: #0079fe;
	}
	.options{
		width: 136.34px;
/*display: block;*/
		height: 170px;
		background-color: white;
		box-shadow: 1px 14px 20px 2px #e8e8e8;
/*top: 8.3%;*/
		right: 4.7%;
	}
.options div{
	text-align: center;
	/*padding: 5px 5px;*/

}
	.options div:hover{
		background-color: rgba(24, 144, 255,1);

	}

	.options div:hover a{
	color: #eeeeee;

	}

	.menu:hover .options{
animation: anim .4s ;
	}

	@keyframes anim {
0%{
	height: 0px;
}
		100%{
			height: 170px;
		}
	}


</style>
